package com.zusmart.core.bean.support;

import com.zusmart.core.bean.BeanDefinitionRegistry;
import com.zusmart.core.bean.BeanDefinitionResolver;
import com.zusmart.core.bean.BeanDefinitionType;
import com.zusmart.core.bean.BeanInstanceCreator;

public class BeanDefinitionForObject extends AbstractBeanDefinition {

	private Object targetBeanInstance;

	public BeanDefinitionForObject(BeanDefinitionResolver beanDefinitionResolver, BeanDefinitionRegistry beanDefinitionRegistry, Object targetBeanInstance, String beanName) {
		super(beanDefinitionResolver, beanDefinitionRegistry, beanName, SCOPE_SINGLETON, targetBeanInstance.getClass());
		this.targetBeanInstance = targetBeanInstance;
	}

	@Override
	public BeanDefinitionType getBeanType() {
		return BeanDefinitionType.Object;
	}

	@Override
	protected BeanInstanceCreator createBeanInstanceCreator() {
		return new BeanInstanceCreatorForObject(this);
	}

	public Object getTargetBeanInstance() {
		return this.targetBeanInstance;
	}

}